<%@page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<%
	String path =request.getContextPath();
%>
<head>
    <meta http-equiv="x-ua-compatible" content="ie=7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" type="text/javascript" src="<%=path%>/js/validatorTool.js"></script>
	<script language="javascript" type="text/javascript" src="<%=path%>/js/utilTool.js"></script>
	<script language="javascript" type="text/javascript">
	
		function qrySendOrderItem(){
			var url="<%=path%>/other/goQryPageFromAdd";
			location.href = url;
		}

		function setItemValue(name,value){
			var items=document.getElementsByName(name);
			if(items!=null && items.length>0){
				for(var i=0;i<items.length;i++){
					items[i].value=value;
				}
			}
		}

		function save(){
			var sendNoticeNo=trim(document.getElementById("send_notice_no").value);
			var sendNnums= document.getElementsByName("sendNnum");
			var planArrDates= document.getElementsByName("planArrDate");
			//if(sendNoticeNo==null || sendNoticeNo==""){
			//	alert("请输入发货通知号");
			//	return ;
			//}
			if(sendNnums.length>0){
				for(var i=0; i<sendNnums.length;i++){
					var sendNum=trim(sendNnums[i].value);
					if(sendNum==null || sendNum==""){
						alert("第"+(i+1)+"行发货数量不能为空");
						return ;
					}		
					var planArrDate=trim(planArrDates[i].value);
					if(planArrDate==null || planArrDate==""){
						alert("第"+(i+1)+"行计划到货日期不能为空");
						return ;
					}		
				}
			}else{
				alert("请添加产品明细");
				return ;
			}
			
			form2.action="<%=path%>/other/saveMySendPlan"
			form2.submit();
			
		}
		
		function commit(){
			var sendNoticeNo=trim(document.getElementById("send_notice_no").value);
			var sendNnums= document.getElementsByName("sendNnum");
			var planArrDates= document.getElementsByName("planArrDate");
			//if(sendNoticeNo==null || sendNoticeNo==""){
			//	alert("请输入发货通知号");
			//	return ;
			//}
			if(sendNnums.length>0){
				for(var i=0; i<sendNnums.length;i++){
					var sendNum=trim(sendNnums[i].value);
					if(sendNum==null || sendNum==""){
						alert("第"+(i+1)+"行发货数量不能为空");
						return ;
					}		
					var planArrDate=trim(planArrDates[i].value);
					if(planArrDate==null || planArrDate==""){
						alert("第"+(i+1)+"行计划到货日期不能为空");
						return ;
					}		
				}
			}else{
				alert("请添加产品明细");
				return ;
			}
			form2.action="<%=path%>/other/cmtMySendPlan"
			form2.submit();
		}
		
		function goback(){
			var url="<%=path%>/other/goBack2SenNoticeList"
			location.href=url;
		}
		
		//add by yf 2013-09-10 计算金额
		function doCalPrice(index){
			editRow = index - 1;
			var sendNnums = document.getElementsByName("sendNnum"); 
			var nTaxPrices =  document.getElementsByName("nTaxPrice"); 
			var sendNnum = sendNnums[editRow].value;
			var nTaxPrice = nTaxPrices[editRow].value;
			var nTaxMnys =  document.getElementsByName("nTaxMny"); 
			nTaxMnys[editRow].value =  subRedubqNum(nTaxPrice * sendNnum + "",2);
			document.getElementById("nTaxMny"+index).innerHTML  = nTaxMnys[editRow].value
		}
	</script>
</head>
<body class="fullbody">
            <div class="context">
                <div class="position">
                    <div class="tposi">当前位置： 
                        <a href="javascript:changeMenu(1,'<%=path%>/infopub/pubmain?menuid=1');"class="linkstyle">首页</a>&nbsp;&gt;&gt;&nbsp;
                   		<a href="javascript:changeMenu(3,'');" class="linkstyle">我的订单\合同</a>&nbsp;&gt;&gt;&nbsp;
                        <span class="curposition">我的发货通知</span>
                    </div>
                    <div class="help">
						<a href="javascript:void(null);" onclick="doHelp('<%=request.getContextPath()%>/help/html/WDFHTZ.html');" class="linkstyle">帮助</a>
					</div>
                </div>
                <div class="margin8"></div>
                <div class="subpage_title">
                    <div class="title_index">
                        <img src="<%=path%>/images/common/dot03.gif" alt="" border="0" />&nbsp;我的发货通知</div>
                </div>
                <div class="subpage_bidlist">
                    <div class="subpage_search" >
                    	<form name="form1" action="<%=path%>/other/qryOrderItemInfo" method="post" >
	                        <table border="0" cellpadding="0" cellspacing="0" class="searchtable">
	                             <tr>
	                                <td valign="middle" class="w_1">发货通知号：</td>
	                                <td valign="middle" class="w_2">
	                                    <input id="send_notice_no" type="text" name="send_notice_no" value="${send_notice_no}" class="searchtext" 
	                                    	onchange="setItemValue('sendNoticeNo',this.value)" readonly="readonly" />
	                                </td>
	                            	<td valign="middle" class="w_1">发货日期：</td>
	                                <td valign="middle" class="w_2">
	                                    <input type="text"   class="searchdate"  id="id_sendDate" name="sendDate1" value="${sendDate}"
											onclick=" return showCalendar('id_sendDate', 'y-mm-dd');"   
	                                        onblur="setItemValue('sendDate',this.value);"	readonly="readonly"  />
	                                </td>
	                            </tr>
	                            <tr>
	                            	<td valign="middle" class="w_1">运输工具：</td>
	                                <td valign="middle" class="w_2">
	                                <!-- modify by yf 20130927 -->
	                                    <!--
	                                    <input id="pkTransfer"  name="pkTransfer" type="text" value="${transferName}" class="searchtext" 
	                                    	onchange="setItemValue('transferName',this.value)"/>
	                                    	-->
	                                    <select class="searchtext" name="pkTransfer" id="pkTransfer" onchange="setItemValue('transferName',this.value)">
										<option value="汽车"
											<c:if test="${'汽车'==transferName}">selected</c:if>>汽车</option>
										<option value="火车"
											<c:if test="${'火车'==transferName}">selected</c:if>>火车</option>
										<option value="飞机"
											<c:if test="${'飞机'==transferName}">selected</c:if>>飞机</option>
										<option value="轮船"
											<c:if test="${'轮船'==transferName}">selected</c:if>>轮船</option>
	                                    </select>	
	                                </td>
	                                <td valign="middle" class="w_1">物流运输单号：</td>
	                                <td valign="middle" class="w_2">
	                                 <input id="licenceNo" name="licenceNo"  type="text" value="${licenceNo}" class="searchtext"   
	                                    	onchange="setItemValue('licenceNo',this.value)"/>
	                                </td>
	                            </tr>
	                            <tr>
	                            	<td valign="middle" class="w_1">联系人：</td>
	                                <td valign="middle" class="w_2">
	                                    <input id="linkMan" name="linkMan" type="text" value="${linkMan}" class="searchtext"  
	                                    	onchange="setItemValue('linkMan',this.value)"/>
	                                </td>
	                                <td valign="middle" class="w_1">联系方式：</td>
	                                <td valign="middle" class="w_2" colspan="2">
	                                    <input id="linkMode" name="linkMode" type="text" value="${linkMode}" class="searchtext" 
	                                    	onchange="setItemValue('linkMode',this.value)"/>
	                                </td>
	                            </tr>
	                        </table>
	                	</form>
                    </div>
                    <div>
                    	<form name="form2"   method="post" >
                    		<input id="pk_send_notice" type="hidden" name="pk_send_notice" value="${pk_send_notice}" />
                    		<input id="billstatus" type="hidden" name="billstatus" value="${billstatus}" />
	                       <table class="tableCss" cellpadding="0" cellspacing="0">
                            	<tr class="titleTr">
	                                <th width="200">订单号</th>
	                                <th width="260">产品</th>
	                                <th width="100px">数量</th>
	                                <th width="90px">预计到货日期</th>
	                                <th width="150px" class="th1">备注</th>
	                            </tr>
	                            <c:if test="${orderSubForms!=null}">
									<c:forEach items="${orderSubForms}" var="orderSubForm" varStatus="index">
										<c:if test="${orderSubForm.index%2==1}">
											<tr align="left" class="contTr-old"  >
										</c:if>
										<c:if test="${orderSubForm.index%2==0}">
											<tr align="left" class="contTr-even">
										</c:if>
											<td class="td1">
												<input type="hidden" name="pkOrg" value="${orderSubForm.pkOrg}" />
												<input type="hidden" name="pkWebArrPlan" value="${orderSubForm.pkWebArrPlan}" />
												<input type="hidden" name="sendNoticeNo" value="${orderSubForm.sendNoticeNo}" />
												<input type="hidden" name="pkOrder" value="${orderSubForm.pkOrder}" />
												<input type="hidden" name="pkItemOrder" value="${orderSubForm.pkItemOrder}" />
												<input type="hidden" name="pkProd" value="${orderSubForm.pkProd}" />
												<input type="hidden" name="pkMainUnit" value="${orderSubForm.pkMainUnit}" />
												<input type="hidden" name="pkAsisUnit" value="${orderSubForm.pkAsisUnit}" />
												<input type="hidden" name="orderMainNum" value="${orderSubForm.orderMainNum}" />
												<input type="hidden" name="orderAsisNum" value="${orderSubForm.orderAsisNum}" />
												<input type="hidden" name="pkReceiveCorp" value="${orderSubForm.pkReceiveCorp}" />
												<input type="hidden" name="pkReceiveAddr" value="${orderSubForm.pkReceiveAddr}" />
												<input type="hidden" name="pkSendAddr" value="${orderSubForm.pkSendAddr}" />
												<input type="hidden" name="mainUnitName" value="${orderSubForm.mainUnitName}" />
												<input type="hidden" name="asisUnitName" value="${orderSubForm.asisUnitName}" />
												<input type="hidden" name="sendAds" value="${orderSubForm.sendAds}" />
												<input type="hidden" name="ordernum" value="${orderSubForm.ordernum}" />
												<input type="hidden" name="hts" value="${orderSubForm.hts}" />
												<input type="hidden" name="bts" value="${orderSubForm.bts}" />
												<input type="hidden" name="bbts" value="${orderSubForm.bbts}" />
												<input type="hidden" name="pkArrStroorg" value="${orderSubForm.pkArrStroorg}" />
												<input type="hidden" name="changeRate" value="${orderSubForm.changeRate}" />
												<input type="hidden" name="pkOrg_v" value="${orderSubForm.pkOrg_v}" />
												<input type="hidden" name="pkProd_v" value="${orderSubForm.pkProd_v}" />
												<input type="hidden" name="pkArrStroorg_v" value="${orderSubForm.pkArrStroorg_v}" />
												<input type="hidden" name="qtUnitRate" value="${orderSubForm.qtUnitRate}" />
												<input type="hidden" name="prodCode" value="${orderSubForm.prodCode}" />
												<input type="hidden" name="pkQtUnit" value="${orderSubForm.pkQtUnit}" />
												<input type="hidden" name="orderItemNo" value="${orderSubForm.orderItemNo}" />
												<input type="hidden" name="prodName" value="${orderSubForm.prodName}" />
												<input type="hidden" name="desc" value="${orderSubForm.desc}" />
												<input type="hidden" name="measureName" value="${orderSubForm.measureName}" />
												<input type="hidden" name="sendDate" value="${orderSubForm.sendDate}" /> 
												<input type="hidden" name="receiveAdsName" value="${orderSubForm.receiveAdsName}"/>
												<input type="hidden" name="orderNo" value="${orderSubForm.orderNo}" />
												<input type="hidden" name="transferName" value="${orderSubForm.transferName}"/>
												<input type="hidden" name="licenceNo" value="${orderSubForm.licenceNo}"/>
												<input type="hidden" name="linkMan" value="${orderSubForm.linkMan}"/>
												<input type="hidden" name="linkMode" value="${orderSubForm.linkMode}"/>
												<input type="hidden" name="pkTransfer" value="${orderSubForm.pkTransfer}"/>
												<input type="hidden" name="receiveCorpName" value="${orderSubForm.receiveCorpName}"/>
												<!-- modify by yf 2013-09-10  begin -->
												<input type="hidden" name="contractNo" value="${orderSubForm.contractNo}"/>
												<input type="hidden" name="nTaxPrice" value="${orderSubForm.nTaxPrice}"/>
												<input type="hidden" name="nTaxMny" value="${orderSubForm.nTaxMny}"/>
												<input type="hidden" name="graphid" value="${orderSubForm.graphid}"/>
												<input type="hidden" name="def18" value="${orderSubForm.def18}"/>
												<input type="hidden" name="def20" value="${orderSubForm.def20}"/>
												订单号：${orderSubForm.orderNo}<br/>
												合同号：${orderSubForm.contractNo}<br/>
												到货分公司：${orderSubForm.receiveCorpName}<br/>
												交货日期：${orderSubForm.delivdate}
											</td>
											<td class="td1">
												<span class="prodName">名称：${orderSubForm.prodName}</span><br/>
												<!-- 存货编码、存货名称、规格、图号、主机号、技术要求、计量单位、数量、含税单价、含税金额 -->
												<c:if test="${orderSubForm.prodCode!=null && ''!=orderSubForm.prodCode}">
													编码：${orderSubForm.prodCode} <br/>
												</c:if>
												<c:if test="${orderSubForm.model!=null && ''!=orderSubForm.model}">
													规格：${orderSubForm.model} <br/>
												</c:if>
												<c:if test="${orderSubForm.type!=null && ''!=orderSubForm.type}">
													型号：${orderSubForm.type}<br/>
												</c:if>
												<c:if test="${orderSubForm.graphid!=null && ''!=orderSubForm.graphid}">
													图号：${orderSubForm.graphid} <br/>
												</c:if>
												<c:if test="${orderSubForm.def18!=null && ''!=orderSubForm.def18}">
													主机号：${orderSubForm.def18} <br/>
												</c:if>
												<c:if test="${orderSubForm.def20!=null && ''!=orderSubForm.def20}">
													技术要求：${orderSubForm.def20}<br/>
												</c:if>
												<c:if test="${orderSubForm.desc!=null && ''!=orderSubForm.desc}">
													描述：${orderSubForm.desc}&nbsp;
												</c:if>
											</td>
											<td class="td1">
												<input type="text" class="input-edit" name="sendNnum" value="${orderSubForm.leftNum}" 
													onkeypress="javascript:keyPress(this);" /> ${orderSubForm.measureName}&nbsp;
													<br/>
											</td>
											<!-- modify by yf 2013-09-10  end -->
											<td class="td1">
												<input type="text" class="input-edit" id="${orderSubForm.pkItemOrder}2"  name="planArrDate" value="${orderSubForm.planArrDate}"
													onclick="return showCalendar('${orderSubForm.pkItemOrder}2', 'y-mm-dd');"   
													readonly="readonly" /> &nbsp;
											</td>
											<td class="td1">
												<input type="text" class="memo-edit" name="memo" value="${orderSubForm.memo}"/>&nbsp;
											</td>
										</tr>
									</c:forEach>
								</c:if>
	                        </table>
	                        <br/><br/>
	                        <table border="0" cellpadding="0" cellspacing="0" align="center">
	                            <tr>
	                                <td valign="middle" colspan="20" align="center">
	                                    <input type="button" class="btnscs" value="保存" onclick="save()"/>&nbsp;&nbsp;
	                                    <input type="button" class="btnscs" value="提交" onclick="commit()"/>&nbsp;&nbsp;
	                                   <!--  <input type="button" class="btnscs" value="添加" onclick="qrySendOrderItem()"/> -->
	                                    <input type="button" class="btnscs" value="返回" onclick="goback()"/>&nbsp;&nbsp;
	                                </td>
	                            </tr>
	                        </table>
	                	</form>
                    </div>
                    <div class="margin8"></div>
                </div>
            </div>
        <div class="margin8">
       	  	<table align="left">
				<tr class="title">
					<td>
						<div id="message" class="msgcolor">${system_err_msg}</div>
					</td>
				</tr>
			</table>
		</div> 
        <div class="margin20"></div>
<!--    </div>-->
</body>
</html>
